#!/bin/bash

# 检测Python版本
if command -v python3 &>/dev/null; then
    PYTHON=python3
elif command -v python &>/dev/null; then
    PYTHON=python
else
    echo "未找到Python，无法启动HTTP服务器。"
    echo "请安装Python或手动打开index.html文件。"
    exit 1
fi

echo "启动HTTP服务器，请在浏览器中访问 http://localhost:8000"
echo "按Ctrl+C可以停止服务器"

# 启动HTTP服务器
if [[ $PYTHON == "python3" ]]; then
    $PYTHON -m http.server 8000
else
    $PYTHON -m SimpleHTTPServer 8000
fi 